package com.avic.common.convertor;


import com.avic.controller.info.InformationReportInfo;
import com.avic.dal.model.InformationReport;

import java.util.ArrayList;
import java.util.List;

public class InformationReportConvertor {

    public static List<InformationReportInfo> informationReportsToInformationReportInfo(List<InformationReport> informationReports) {
        if (null != informationReports && informationReports.size() > 0) {
            List<InformationReportInfo> informationReportInfos = new ArrayList<>();
            informationReports.forEach(informationReport -> {
                informationReportInfos.add(informationReportToInformationReportInfo(informationReport));
            });
            return informationReportInfos;
        }
        return new ArrayList<>();
    }

    public static InformationReportInfo informationReportToInformationReportInfo(InformationReport informationReport) {
        if (null != informationReport) {
            InformationReportInfo informationReportInfo = new InformationReportInfo();
            informationReportInfo.setCreateTime(informationReport.getCreateTime());
            informationReportInfo.setCreateUserName(informationReport.getCreateUserName());
            informationReportInfo.setId(informationReport.getId());
            informationReportInfo.setReportContext(informationReport.getReportContext());
            informationReportInfo.setReportName(informationReport.getReportName());
            informationReportInfo.setReportNumber(informationReport.getReportNumber());
            informationReportInfo.setReportType(informationReport.getReportType());
            return informationReportInfo;
        }
        return null;
    }
}
